import time

from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

if __name__ == '__main__':
    service = Service(executable_path="./chromedriver.exe")
    driver = WebDriver(service=service)
    driver.get(url='https://www.btnull.si/user/login/')
    input_username = driver.find_element(By.XPATH, '/html/body/main/div/form/div[1]/div[1]/input')
    password = driver.find_element(By.XPATH, '/html/body/main/div/form/div[2]/div[1]/input')
    close = driver.find_element(By.XPATH, '/html/body/div[1]/div[2]/div[1]/div')
    submit = driver.find_element(By.XPATH, '//*[@id="button"]')
    close.click()
    time.sleep(2)
    input_username.send_keys('zikunli5@gmail.com')
    password.send_keys('adcbtug0189')
    submit.click()

    time.sleep(2)
    # 切换页面
    driver.switch_to.window(driver.window_handles[-1])
    close1 = driver.find_element(By.XPATH, '/html/body/div[1]/div[2]/div[1]/div')
    close1.click()
    time.sleep(15)
